package com.assisjrs.jpaandroid.sample.basic;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;

import com.assisjrs.jpaandroid.persistence.Entity;

public abstract class BaseAdapter<T extends Entity> extends
		android.widget.BaseAdapter {
	protected LayoutInflater inflater;
	protected List<T> listItens;

	public BaseAdapter(final Context ctx, final List<T> itens) {
		this.listItens = itens;

		inflater = (LayoutInflater) ctx
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}

	public int getCount() {
		return listItens.size();
	}

	public Object getItem(final int position) {
		return listItens.get(position);
	}

	public long getItemId(final int position) {
		return listItens.get(position).getId();
	}
}
